<?php
namespace Plugin\Attractions\AttractionManagement\Schema\Attraction_info;

use Plugin\Attractions\AttractionManagement\Model\Attraction_info\AttractionInfo;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 信息资讯表
 */
#[Schema(title: 'AttractionInfoSchema')]
class AttractionInfoSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: 'id', type: 'bigint')]
    public string $id;

    #[Property(property: 'title', title: '标题', type: 'varchar')]
    public string $title;

    #[Property(property: 'intro', title: '信息内容', type: 'longtext')]
    public string $intro;

    #[Property(property: 'group', title: '信息分组1活动2优惠3交通', type: 'int')]
    public string $group;

    #[Property(property: 'type_id', title: '类型id', type: 'int')]
    public string $type_id;

    #[Property(property: 'spot_id', title: '点位id', type: 'int')]
    public string $spot_id;

    #[Property(property: 'cover_id', title: '封面id', type: 'varchar')]
    public string $cover_id;

    #[Property(property: 'status', title: '是否显示状态1正常2停止3时间字段决定,优先级高于时间控制', type: 'int')]
    public string $status;

    #[Property(property: 'sort', title: '排序', type: 'int')]
    public string $sort;

    #[Property(property: 'start_time', title: '开始时间', type: 'datetime')]
    public string $start_time;

    #[Property(property: 'end_time', title: '结束时间', type: 'datetime')]
    public string $end_time;

    #[Property(property: 'extension', title: '扩展信息', type: 'json')]
    public string $extension;

    #[Property(property: 'created_at', title: 'created_at', type: 'datetime')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'datetime')]
    public string $updated_at;




    public function __construct(AttractionInfo $model)
    {
       $this->id = $model->id;
       $this->title = $model->title;
       $this->intro = $model->intro;
       $this->group = $model->group;
       $this->type_id = $model->type_id;
       $this->spot_id = $model->spot_id;
       $this->cover_id = $model->cover_id;
       $this->status = $model->status;
       $this->sort = $model->sort;
       $this->start_time = $model->start_time;
       $this->end_time = $model->end_time;
       $this->extension = $model->extension;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'title' => $this->title ,'intro' => $this->intro ,'group' => $this->group ,'type_id' => $this->type_id ,'spot_id' => $this->spot_id ,'cover_id' => $this->cover_id ,'status' => $this->status ,'sort' => $this->sort ,'start_time' => $this->start_time ,'end_time' => $this->end_time ,'extension' => $this->extension ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at];
    }
}